Workflow Human Template
The Workflow Human template demonstrates how BindAI can pause workflow execution by creating aHumanTask and placing the workflow context into a waiting state.
The HumanTaskNode is designed for human-in-the-loop workflows where an external interface or application can inspect the created task and handle the human interaction.
Purpose
This template demonstrates how to:- create a human task
- associate the task with a workflow instance
- associate the task with a workflow node
- store the task in the workflow context
- pause workflow execution using the waiting state
- configure an optional assignee
- configure an optional form
Workflow Structure
A workflow can place a Human Task node between normal workflow nodes.Human Task Node
The implementation is provided byHumanTaskNode.
Conceptually:
Task Creation
When the node executes, it creates a newHumanTask.
The task receives a generated UUID.
- task ID
- workflow instance ID
- node ID
- creation timestamp
Workflow Context
The newly created task is stored in the workflow context.Waiting State
After creating the task, the node sets:External Task Handling
HumanTaskNode does not provide a user interface.
The task can instead be consumed by an external system such as:
- a web application
- an administrative dashboard
- an approval interface
- a mobile application
- an internal task-management system
Assignee
A Human Task may optionally specify an assignee. Example:Form
A Human Task may also specify an optional form identifier. Example:Task Lifecycle
The implemented lifecycle is limited to task creation and entering the waiting state.HumanTaskNode implementation.
Workflow Instance Association
Every created task is associated with the currently executing workflow instance.Node Association
The generated task also records the ID of the node that created it.Unique Task IDs
Every execution creates a new task ID using Python’s UUID generator.Serialization
HumanTaskNode extends the normal workflow-node serialization.
Its serialized representation includes:
Loading Configuration
The node can restore its human-task configuration from serialized data. The implementation reads:None.
Human + AI Workflow
A common workflow pattern is:Human Tasks vs Conditions
These nodes serve different purposes.
A workflow can combine both patterns.
For example:
Human Tasks vs Loops
Human Tasks and loops also have different purposes.
A loop repeats automatically according to workflow state, while a Human Task introduces an external waiting point.
Example
A document-review workflow might look like:Important Implementation Boundary
TheHumanTaskNode implementation does not:
- approve a task
- reject a task
- collect form responses
- notify an assignee
- render a form
- mark a task as completed
- resume the workflow
Best Practices
- Provide a meaningful
node_id. - Use
assigneewhen an external system needs an intended task owner. - Use
formto associate a task with an external form definition. - Keep task presentation outside the workflow node.
- Treat
context.taskas the runtime task created by the node. - Ensure the surrounding application provides a mechanism for handling waiting workflows.
- Keep human interaction logic separate from workflow-definition logic.
Summary
The Workflow Human template demonstrates how BindAI introduces a human interaction point into workflow execution.HumanTaskNode creates a uniquely identified HumanTask, associates it with the current workflow instance and node, stores it in context.task, and sets context.waiting = True.
The node does not implement approval, rejection, form handling, notifications, or workflow resumption. Those behaviors are provided by the surrounding workflow and application infrastructure.